<?php

/**
 * This file is part of the Pagizer package.
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 *
 * @copyright   Copyright (c) 2010 Advisa (http://www.advisa.fr)
 * @author      Pagizer Core Team <team@pagizer.org>
 * @package     Pagizer
 * @subpackage  backoffice
 */

class m_backoffice_actions_block_SliderMenuAction extends m_backoffice_extends_Action
{
	public function execute()
	{	
		$href = $this->getRequestParameter("href", "/website/list");

        if($href == '')
        {
            $href = "/website/list";
        }

		f_core_Routing::getInstance()->setRequestURL($href);	
			
		$docId = $this->getRequestParameter("docId");
		$docLang = $this->getRequestParameter("docLang");

		$this->addToModel("refId", $docId);
		
		$menuService = m_backoffice_services_MenuService::getInstance();
		$nodeLabel = null;
		$node = null;
		
		$moduleName = $this->getRequestParameter("module");
		
		if(!is_null($this->getRequestParameter("configModule")) && $this->getRequestParameter("configModule") != "")
		{
			$moduleName = $this->getRequestParameter("configModule");
		}

        // System panel
        if(!is_null($this->getRequestParameter('panel')) && $this->getRequestParameter('panel') == 'System')
        {
            return f_core_Controller::getInstance()->setModule('backoffice')->setAction('block_SystemMenu')->dispatch();
        }

		$menuTree = $menuService->getMenuTree($moduleName, $docId, $docLang);

		$this->addToModel("module", $moduleName);
		$this->addToModel("menuTree", $menuTree);

		$this->setView("success");
	}
}